@extends('layouts.template')

@section('title', '管理后台')

@section('content')

    <script>
        $(function(){

            var validator = $("#form").validate({
                rules: {
                    'cash_ids[]':{
                        required:true,
                    },
                },
                messages: {
                    'cash_ids[]':{
                        required:'请至少选择一项',
                    },
                },
                submitHandler: function(form) {
                    form.submit();
                },
            });

        });

    </script>



    <div class="contentpanel" id="contentpanel">

        <div class="row">
            <div class="col-md-12">

                <!-- Nav tabs -->
                <ul class="nav nav-tabs">
                    <li class="active"><a><strong>待审核放款</strong></a></li>
                    <li><a href="{{url('finance/mastercashed')}}"><strong>已审核放款</strong></a></li>
                    <li><a href="{{url('finance/mastercashrefuse')}}"><strong>已拒绝放款</strong></a></li>
                </ul>

                <!-- Tab panes -->
                <div class="tab-content mb30">
                    <div class="tab-pane active" id="detail">

                        <div class="panel panel-default">
                            <div class="panel-body">
                                <form action="" method="GET" class="form-inline">
                                    <div>
                                        {!! $filter !!}
                                    </div>
                                </form>
                            </div>
                        </div>

                        <form action="{{url('finance/cash/agree')}}" method="POST" id="form">
                            {{csrf_field()}}
                        <div class="form-group">
                            <label>
                                <button onclick="return confirm('再次确认批量放款？')" class="btn btn-warning" type="submit">批量放款</button>
                            </label>
                        </div>

                        <div class="table-responsive">
                            <table class="table mb30">
                                <thead>
                                <tr style="white-space:nowrap">
                                    <th><input type="checkbox" onclick="checkall(this)">选择</th>
                                    <th>师傅名字</th>
                                    <th>申请时间</th>
                                    <th>流水号</th>
                                    <th>提现金额(元)</th>
                                    <th>账户名</th>
                                    <th>账号</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php foreach ($list as $row):?>
                                <tr data-id="{{$row->id}}">
                                    <td><input type="checkbox" value="{{$row->assoc->id}}" name="cash_ids[]"></td>
                                    <td>{{$row->master_name}}</td>
                                    <td>{{$row->add_time}}</td>
                                    <td>{{$row->trade_number}}</td>
                                    <td>{{$row->amount}}</td>
                                    <td>{{$row->assoc->alipay_name}}</td>
                                    <td>{{$row->assoc->alipay_account}}</td>
                                    <td>{{$row->assoc->status_text}}</td>
                                    <td>
                                        <a onclick="return confirm('再次确认放款')" href="{{url("finance/cash/agree/{$row->assoc->id}")}}" class="btn btn-warning">放款</a>
                                        <a onclick="return confirm('拒绝提现')" href="{{url("finance/cash/disagree/{$row->assoc->id}")}}" class="btn btn-danger">拒绝</a>
                                    </td>
                                </tr>
                                <?php endforeach;?>
                                </tbody>
                            </table>
                        </div>
                        </form>
                        <!-- table-responsive -->
                        {{ @!$list->isEmpty() ? $list->appends(request()->all())->links() : '' }}

                    </div><!-- tab-pane -->
                </div><!-- tab-content -->


            </div>
            <!-- col-md-12 -->
        </div>
    </div><!-- contentpanel -->


@endsection

